<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var me,gm;
        me = Number(prompt('请输入1.2.3，1代表石头，2代表剪刀，3代表布'));
        gm = parseInt(Math.random()*3+1);
        switch(gm){
            case 1:
                switch(me){
                    case 1:
                        alert('平局');
                    break;  
                    case 2:
                        alert('我输了');
                    break;  
                    case 3:
                        alert('我赢了');
                    break;    
                }
            break;
            case 2:
                switch(me){
                    case 1:
                        alert('我赢了');
                    break;  
                    case 2:
                        alert('平局');
                    break;  
                    case 3:
                        alert('我输了');
                    break;    
                }
            break;   
            case 3:
                switch(me){
                    case 1:
                        alert('我输了');
                    break;  
                    case 2:
                        alert('我赢了');
                    break;  
                    case 3:
                        alert('平局');
                    break;    
                }
            break;       
        }
    </script>
</body>
</html>